01. Project Overview

Chat Room

For this project, you are going to build a chatroom using WebSocket and STOMP with Spring Boot MVC framework.

  • You are going to implement the Model, Controller, and the View.
  • The Chatroom will include a login page and chatroom page, where users can join the room and chat with other users.

If everything runs fine, you can package your application, and you can deploy it on the cloud.

The project can be found at this Github repo or by downloading the starter code from the Resources folder in this lesson.

Project Structure

Please take a look at the following instructions for the project:

  1. File: src/main/java/edu/udacity/java/nano/WebSocketChatApplication.java: SprintBoot main file. No need to update.
  2. File src/main/java/edu/udacity/java/nano/Message.java: message model. It needs to be implemented. Please reference the message model we had in websocket lesson.
  3. File src/main/java/edu/udacity/java/nano/WebSocketChatServer.java: controller. It needs to be implemented.
    • onOpen: add on open connection to establish the connection.
    • onMessage: 1) Get username and session. 2) Send message to all.
    • sendMessageToAll: send messages to all receivers.
    • onClose: close the connection.
  4. File src/main/java/edu/udacity/java/nano/WebSocketConfig.java: no change.
  5. File src/main/resources/templates/chat.html
    • Check online number nums.
    • Add message container.
    • Add send button to send message.
  6. File src/main/resources/templates/login.html: complete login function.


When you are done writing the code, you can check if it works.

Login to the app:

…and check out that the Chat Room is working:

Have fun coding!